﻿/*
 *  Copyright (C) 2010 by Benjamin Nolmans <benjamin.nolmans@gmail.com>
 *  and Barbara Post <postb99@gmail.com>
 *  Copyright (C) 2010 by Barbara Post postb99@gmail.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

using System.Collections.Generic;
using System.Web.UI;
using OfficeWebUI.Ribbon;
using OsamesFrameworkCore.Messaging;
using OsamesFrameworkCore.Xml.Types;

namespace OsamesFrameworkCore.Plugins
{
    /// <summary>
    /// This interface defines a plugin at highest abstraction level.
    /// </summary>
    public interface IPlugin : ILoggable
    {
        #region attributes/properties
        IPluginHost Host { get; set; }

        /// <summary>
        /// Generated messages by plugin
        /// </summary>
        List<Message> MessagesList { get; }
        
        /// <summary>
        /// Plugin configuration
        /// </summary>
        /// <returns>Return the plugin configuration data in a dictionary</returns>
        XmlDictionaryContainer XmlDictPluginConfiguration { get; set; }

        #endregion

        #region methods

        /// <summary>
        /// Plugin startup
        /// </summary>
        void Initialize();

        /// <summary>
        /// Plugin shutdown
        /// </summary>
        void Dispose();

        /// <summary>
        /// Plugin algorithm call.
        /// </summary>
        /// <param name="strMethodName_">Name of function declared in the plugin to execute by reflection</param>
        /// <param name="oParameters_">Function arguments</param>
        object Execute(string strMethodName_, object[] oParameters_);
       
        #endregion   
      
    }
    /// <summary>
    /// This interface defines a plugin class with a web rendering : as a control tree, 
    /// and optionally as a part of office ribbon of the web application.
    /// </summary>
    public interface IWebPlugin : IPlugin
    {
        /// <summary>
        /// Plugin rendering call
        /// </summary>
        /// <returns>Some kind of web control</returns>
        Control GetOutput();

        /// <summary>
        /// What the plugin should display as a ribbon tab.
        /// Returns null if no rendering (for example not applicable for a special plugin).
        /// </summary>
        /// <returns></returns>
        RibbonContext GetRibbonContextRendering();
    }

    /// <summary>
    /// Plugin host interface.
    /// </summary>
    public interface IPluginHost
    {
        void Feedback(string feedback_, IPlugin plugin_);
    }    
}
